Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minimatch

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimatch

a glob matcher in javascript

  • 6.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
82M
decreased by-61.77%
Maintainers
1
Weekly downloads
 
Created

What is minimatch?

The minimatch npm package is a minimal matching utility that implements the string pattern matching functionality, commonly known as 'globbing'. It is used to match text strings with wildcard characters, such as '*' for multiple characters or '?' for a single character. It is often used in file path matching and filtering operations.

What are minimatch's main functionalities?

Basic string matching

This feature allows for basic pattern matching where a string is tested against a pattern. Wildcards like '*' and '?' can be used to match multiple or single characters respectively.

"use strict";
const minimatch = require("minimatch");

// Match a literal string
console.log(minimatch("foo.js", "foo.js")); // true

// Match with a single wildcard
console.log(minimatch("foo.js", "*.js")); // true

// Match with a single character wildcard
console.log(minimatch("foo.js", "f?o.js")); // true

Negation

This feature allows patterns to be negated so that they match strings that do not match the given pattern.

"use strict";
const minimatch = require("minimatch");

// Negate the match
console.log(minimatch("foo.js", "!foo.js")); // false
console.log(minimatch("bar.js", "!foo.js")); // true

Match options

Minimatch allows for additional options to be set, such as case-insensitivity, to customize the matching behavior.

"use strict";
const minimatch = require("minimatch");

// Match with options
const options = {nocase: true};
console.log(minimatch("FOO.JS", "*.js", options)); // true

Other packages similar to minimatch

FAQs

Package last updated on 13 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc